package com.java.test.algorithm;

/**
 * @author TonyOne
 * @version 1.0
 * @desc
 * @date 2018/10/26 12:13
 * @company
 */
public class Step1OrStep2 {
    /**
     * 有一个N阶的台阶，每次走一到两步，共有多少种走法？
     */
    public static int countCombination(int n) {
        if (n < 0) throw new IllegalArgumentException("必需n>0");
        if(n==0||n==1) return n;
        if(n==2)
            return 2;
        return countCombination(n-1)+countCombination(n-2);
    }

    public static void main(String[] args) {
        System.out.println(countCombination(5));
        System.out.println(countCombination(6));
    }
}
